home *** CD-ROM | disk | FTP | other *** search
/ Teach Your Children: Road Construction Ahead / Teach Your Children: Road Construction Ahead.iso / pc / rca / road.dxr / 00020_Album Parent.ls < prev    next >
Encoding:
Text File  |  1996-07-17  |  7.6 KB  |  269 lines

  1. property printButChannel, printButCover, pointList, pictList, firstPict, photoCount, sandboxChan, firstPictChan, pageNum, pictsPerPage, albumList, selectedPhoto, hiliteChan, trashChan, dragChan, firstLinePict, printButtonObject
  2. global gActorList, gMenuObject
  3.  
  4. on birth me
  5.   set firstPictChan to 2
  6.   set hiliteChan to 8
  7.   set sandboxChan to 11
  8.   set printButChannel to 13
  9.   set dragChan to 16
  10.   set trashChan to 17
  11.   set pictsPerPage to 6
  12.   set firstLinePict to the number of cast "AlbumLineArt1"
  13.   set printButCover to the number of cast "printCoverAlbum"
  14.   set pointList to [point(195, 82), point(141, 200), point(195, 318), point(444, 82), point(498, 200), point(444, 318)]
  15.   set firstPict to the number of cast "3dLoaderEtc"
  16.   set pictList to ["3d.loaderEtc": 0, "3d.exca+grade": 0, "3d.sroller": 0, "VTL1": 0, "VTL2": 0, "VTL3": 0, "VTL4": 0, "VTL5": 0, "VTL6": 0, "VTL7": 0, "VTL8": 0, "VTL9": 0]
  17.   set selectedPhoto to 0
  18.   return me
  19. end
  20.  
  21. on setup me
  22.   add(gActorList, birth(script "Rollover Anim Button Class", "goMenu( gAlbumObject, me )", 11, 11, 5, "RCA-07VO01", "RCA-07RO01"))
  23.   add(gActorList, birth(script "Rollover Anim Button Class", "help( gAlbumObject, me )", 12, 12, 11, EMPTY, "RCA-05RO02"))
  24.   if the printEnabled of gMenuObject then
  25.     set printButtonObject to birth(script "Rollover Anim Button Class", "print( gAlbumObject )", 13, 13, 5, "B713VO03", "B713RO03")
  26.     if selectedPhoto > 0 then
  27.       add(gActorList, printButtonObject)
  28.     end if
  29.   end if
  30.   puppetSprite(hiliteChan, 1)
  31. end
  32.  
  33. on predraw me
  34.   set pageNum to 1
  35.   updateAlbumList(me)
  36.   drawPage(me, pageNum)
  37.   if the printEnabled of gMenuObject = 0 then
  38.     set the castNum of sprite printButChannel to printButCover
  39.     set the locH of sprite printButChannel to 223
  40.     set the locV of sprite printButChannel to 458
  41.     puppetSprite(printButChannel, 1)
  42.   end if
  43. end
  44.  
  45. on selectPhoto me
  46.   if (selectedPhoto = 0) and the printEnabled of gMenuObject then
  47.     add(gActorList, printButtonObject)
  48.   end if
  49.   set selectedPhoto to the clickOn - firstPictChan + 1
  50.   set hilitePoint to getAt(pointList, selectedPhoto)
  51.   set the locH of sprite hiliteChan to getAt(hilitePoint, 1)
  52.   set the locV of sprite hiliteChan to getAt(hilitePoint, 2)
  53. end
  54.  
  55. on trashClick me
  56.   if selectedPhoto > 0 then
  57.     if pageNum = 1 then
  58.       set albumPosition to selectedPhoto
  59.     else
  60.       set albumPosition to selectedPhoto + pictsPerPage
  61.     end if
  62.     trashLid(me, 1)
  63.     set the locH of sprite hiliteChan to 1000
  64.     animatePhoto(me, albumPosition)
  65.     puppetSound("TRASHALB")
  66.     trashLid(me, -1)
  67.     set photoName to getPropAt(albumList, albumPosition)
  68.     deleteAt(albumList, albumPosition)
  69.     setProp(pictList, photoName, 0)
  70.     set photoCount to count(albumList)
  71.     if photoCount <= pictsPerPage then
  72.       set pageNum to 1
  73.     end if
  74.     repeat while soundBusy(1)
  75.     end repeat
  76.     puppetSound(0)
  77.     drawPage(me, pageNum)
  78.     puppetTransition(51, 1)
  79.     set selectedPhoto to 0
  80.     if the printEnabled of gMenuObject then
  81.       clearActor(printButtonObject)
  82.     end if
  83.   end if
  84. end
  85.  
  86. on trashLid me, castDelta
  87.   set the castNum of sprite trashChan to the castNum of sprite trashChan + castDelta
  88.   updateStage()
  89.   startTimer()
  90.   repeat while the timer < 4
  91.   end repeat
  92.   set the castNum of sprite trashChan to the castNum of sprite trashChan + castDelta
  93.   updateStage()
  94. end
  95.  
  96. on animatePhoto me
  97.   set channel to firstPictChan + selectedPhoto - 1
  98.   set the castNum of sprite dragChan to the castNum of sprite channel
  99.   set the locH of sprite dragChan to the locH of sprite channel
  100.   set the locV of sprite dragChan to the locV of sprite channel
  101.   removeSprite(channel)
  102.   updateStage()
  103.   puppetSprite(dragChan, 1)
  104.   set scale to 1
  105.   set width to the width of cast the castNum of sprite dragChan
  106.   set height to the height of cast the castNum of sprite dragChan
  107.   set the stretch of sprite dragChan to 1
  108.   repeat while scale > 0.49000000000000005
  109.     set the width of sprite dragChan to width * scale
  110.     set the height of sprite dragChan to height * scale
  111.     updateStage()
  112.     set scale to scale - 0.01
  113.   end repeat
  114.   animateSprite(dragChan, point(64, 428), 5)
  115.   removeSprite(dragChan)
  116.   set the stretch of sprite dragChan to 0
  117. end
  118.  
  119. on addPhoto me, photoName
  120.   setProp(pictList, photoName, 1)
  121.   updateAlbumList(me)
  122. end
  123.  
  124. on updateAlbumList me
  125.   set albumList to [:]
  126.   repeat with photoNum = 1 to count(pictList)
  127.     if getAt(pictList, photoNum) then
  128.       addProp(albumList, getPropAt(pictList, photoNum), firstPict + photoNum - 1)
  129.     end if
  130.   end repeat
  131.   set photoCount to count(albumList)
  132. end
  133.  
  134. on flipPage me
  135.   if pageNum = 1 then
  136.     if photoCount > pictsPerPage then
  137.       set pageNum to 2
  138.       finishFlip(me)
  139.     end if
  140.   else
  141.     set pageNum to 1
  142.     finishFlip(me)
  143.   end if
  144. end
  145.  
  146. on finishFlip me
  147.   set the locH of sprite hiliteChan to 1000
  148.   puppetSound("pageturn")
  149.   drawPage(me, pageNum)
  150.   puppetTransition(1, 4)
  151.   updateStage()
  152.   set selectedPhoto to 0
  153.   repeat while soundBusy(1)
  154.   end repeat
  155.   puppetSound(0)
  156.   clearActor(printButtonObject)
  157. end
  158.  
  159. on drawPage me, whichPage
  160.   if whichPage = 1 then
  161.     set firstAlbumPos to 1
  162.   else
  163.     set firstAlbumPos to pictsPerPage + 1
  164.   end if
  165.   repeat with pagePosition = 1 to pictsPerPage
  166.     set albumPosition to firstAlbumPos + pagePosition - 1
  167.     if albumPosition <= photoCount then
  168.       drawPicture(me, pagePosition, albumPosition)
  169.       next repeat
  170.     end if
  171.     drawPicture(me, pagePosition, 0)
  172.   end repeat
  173. end
  174.  
  175. on drawPicture me, pagePosition, albumPosition
  176.   set channel to firstPictChan + pagePosition - 1
  177.   if albumPosition = 0 then
  178.     removeSprite(channel)
  179.   else
  180.     set photoPoint to getAt(pointList, pagePosition)
  181.     set the locH of sprite channel to getAt(photoPoint, 1)
  182.     set the locV of sprite channel to getAt(photoPoint, 2)
  183.     set the castNum of sprite channel to getAt(albumList, albumPosition)
  184.   end if
  185.   puppetSprite(channel, 1)
  186. end
  187.  
  188. on print me
  189.   if selectedPhoto > 0 then
  190.     if pageNum = 1 then
  191.       set albumPosition to selectedPhoto
  192.     else
  193.       set albumPosition to selectedPhoto + pictsPerPage
  194.     end if
  195.     set photoName to getPropAt(albumList, albumPosition)
  196.     set pictureNum to getPropPos(pictList, photoName)
  197.     clearAllActors()
  198.     unpuppetAll()
  199.     keepSandboxBut(sandboxChan)
  200.     puppetPalette("AlbumPal")
  201.     go("Grass")
  202.     go(the frame + 1)
  203.     set the stageColor to 0
  204.     puppetPalette("GrayScenePal", 60)
  205.     updateStage()
  206.     puppetPalette(0)
  207.     unLoadCast()
  208.     set lineArtPict to firstLinePict + pictureNum - 1
  209.     set the castNum of sprite 7 to lineArtPict
  210.     set the locH of sprite 7 to 320
  211.     set the locV of sprite 7 to 230
  212.     set the ink of sprite 7 to 0
  213.     puppetSprite(7, 1)
  214.     go("MASgray")
  215.     printBitmap(lineArtPict)
  216.     clearAllActors()
  217.     unpuppetAll()
  218.     puppetSprite(48, 1)
  219.     puppetPalette("GrayScenePal")
  220.     go("Grass")
  221.     go(the frame + 1)
  222.     set the stageColor to 255
  223.     unLoadCast()
  224.     predraw(me)
  225.     puppetPalette("AlbumPal", 60)
  226.     updateStage()
  227.     puppetPalette(0)
  228.     go("Album")
  229.     puppetSprite(48, 0)
  230.     set selectedPhoto to 0
  231.     clearActor(printButtonObject)
  232.     abort()
  233.   else
  234.     showAllActors()
  235.   end if
  236. end
  237.  
  238. on saveAlbum me
  239.   set albumData to EMPTY
  240.   repeat with x = 1 to count(pictList)
  241.     set albumData to albumData & string(getAt(pictList, x)) & ","
  242.   end repeat
  243.   return albumData
  244. end
  245.  
  246. on loadAlbum me, index
  247.   repeat with x = 1 to count(pictList)
  248.     setAt(pictList, x, value(item index of the dataString of gMenuObject))
  249.     set index to index + 1
  250.   end repeat
  251.   return index
  252. end
  253.  
  254. on goMenu me, buttonObject
  255.   set selectedPhoto to 0
  256.   clearAllActors()
  257.   unpuppetAll()
  258.   makeButtonJump(buttonObject)
  259.   puppetPalette("AlbumPal")
  260.   go("Grass")
  261.   go(the frame + 1)
  262.   unLoadCast()
  263.   goLocationMap()
  264. end
  265.  
  266. on help me, buttonObject
  267.   birth(script "Help Parent", buttonObject, #Album)
  268. end
  269.